@extends('develop.layoutList')

@section('title')
    <li class="cur">
        <span>模块样式库管理</span>
    </li>
@endsection

@section('css')
    <style>
        .form-group{margin-bottom:9px; padding:0px;}
    </style>
@endsection

@section('btn')
    <button class="btn btn-primary" type="button" onclick="Module.edit(0);">添加</button>
@endsection
@section('search')

    <input type="text"  class="form-control" name="style_name" id="style_name" value="" style="width:200px;" placeholder="请输入模块样式库名称">
    <input type="hidden" class="form-control" name="id">

@endsection

@section('js')
    <script>

        var bootstrap_table_ajax_url = '/lar/develop/module/style/search';
        bootstrap_table({
            sortName: 'id', //排序字段
            sortOrder: 'DESC',//排序方式
            columns: [ //字段
                { title: '操作', field: 'operation', align: 'center' },
                { title: '样式库名称', field: 'style_name', align: 'left'},
                { title: '所属模块', field: 'module_name', align: 'left' },
                { title: '所属模块类型', field: 'module_type', align: 'left' }
            ]
        });

        var Module = {

            //编辑样式库
            edit: function (id,flag) {

                this.layer_index = layer.open({
                    title: false,
                    type: 2,
                    area: ['100%','100%'],
                    scrollbar: false,
                    content: '/lar/develop/module/style/edit/'+'&id='+id+'&flag='+flag,
                    closeBtn: false
                });

            },

            //删除样式库
            del:function( id ) {

                layer.confirm('确认删除这个样式库吗?',{icon:3}, function (index) {
                    layer.close( index );
                    E.ajax({
                        type:'get',
                        url:'/lar/develop/module/style/delete/'+id,
                        success:function( obj ) {
                            if( obj.code == 200 ) {
                                layer.alert('样式库信息删除成功', {icon: 1, offset: '70px', time: 2000});
                                Module.load();
                            }else{
                                layer.alert(obj.message,{icon:2});
                                Module.load();
                            }
                        }
                    });
                });
            },

            //重新加载表格
            load: function() {
                //刷新表格
                $('#table').bootstrapTable('refresh');
            }
        }

    </script>
@endsection